package com.hgl.dao;

import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;

import org.junit.Test;

import com.hgl.entity.Config;
import com.hgl.entity.Hgl;
import com.hgl.service.HglService;
import com.hgl.service.impl.HglServiceImpl;
import com.hgl.vo.HglVO;

public class HglimplTest {
	
	private HglService hglservice = new HglServiceImpl();
	

	@Test
	public void selectById(){
		Hgl hgl=new Hgl();
		
		HglDAO hd=new DAOiml();
		List<Hgl> list = hd.selectALL();
		
		list.forEach(System.out::println);
	}
	@Test
	public void updateByid(){
		SimpleDateFormat sp= new SimpleDateFormat("yyyy-mm-dd");
		Hgl h;
		try {
			h=new Hgl(1,"金额案件",99,"110",sp.parse("2020-09-08"));
			HglDAO hg1=new DAOiml();
			hg1.updateById(h);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	@Test
	public void paging() {
//		List<Hgl> hgl=hglservice.list(1, 5);
//		hgl.forEach(System.out::println);
		HglDAO hd=new DAOiml();
		List<Hgl> hgl= hd.paging(1, 5);
		hgl.forEach(System.out::println);
		
	} 
	@Test
	public void selectByName(){
			ConfigDAO cs  = new ConfigDAO();
			try {
				Config selectById = cs.selectById("count");
				System.out.println(selectById);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
}
